// Výchozí zvláštní znaky
$.texyla("setDefaults", {
	symbols: [
		"&", "@", ["<", "&lt;"], [">", "&gt;"], "[", "]", "{", "}", "\\", 
		"α", "β", "π", "µ", "Ω", "∑", "°", "∞", "≠", "±", "×", "÷", "≥",
		"≤", "®", "™", "€", "£", "$", "~", "^", "·", "•"
	],
	symbolWindowDimensions: [300, 230]
});

// tlačítko
$.texyla("addButton", "symbol", function (e) {
	var _this = this;
	
	var el = $('<div></div>');
	var symbolsEl = $('<div class="symbols"></div>').appendTo(el);
	
	var symbols = this.options.symbols;
	
	// projít smajly
	for (var i = 0; i < symbols.length; i++) {
		function clk(text) {
			return function () {
				_this.texy.replace(text);
				
				if (el.find("input.close-after-insert").get(0).checked) {
					el.dialog("close");
				}
			}
		};
		
		$("<span class='ui-default-state'></span>")
			.text(symbols[i] instanceof Array ? symbols[i][0] : symbols[i])
			.click(clk(symbols[i] instanceof Array ? symbols[i][1] : symbols[i]))
			.appendTo(symbolsEl);
	}
	
	// kontrolka na zavření po vložení
	el.append("<br><label><input type='checkbox' checked class='close-after-insert'> " + this.lng.windowCloseAfterInsert + "</label>");
	
	// vytvoření okna
	this.window({
		name: "symbol",
		el: el,
		title: this.lng.symbolHeading
	});
});
